package com.itheima_3;

import java.lang.reflect.Method;

public class RFilectDemo {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        //mothed();
        //method1();
        Class aClass = Class.forName("com.itheima_3.Student");
        Method function1 = aClass.getMethod("function1");
        System.out.println(function1);
        Method function2 = aClass.getMethod("function2", String.class);
        System.out.println(function2);
        Method show = aClass.getDeclaredMethod("show");
        System.out.println(show);

    }

    public static void method1() throws ClassNotFoundException {
        Class aClass = Class.forName("com.itheima_3.Student");
        Method[] declaredMethods = aClass.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            System.out.println(declaredMethod);
        }
    }

    public static void mothed() throws ClassNotFoundException {
        Class aClass = Class.forName("com.itheima_3.Student");
        Method[] methods = aClass.getMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }
}
